package com.dahua.messagesyncsh.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.sql.Date;
import java.sql.Timestamp;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class SensorData {

    public static final String prefix = "sensordata";
    
    private String tableName;

    private Integer sensorId;
    
    private Long id;
    private Integer uploadStatus;
    private Integer stationId;
    private String time;
    private Integer eqId;
    private Integer vibSensorNo;
    private String timeSigFile;
    private String fftFile;
    private String psdFile;
    private String envelopeFile;
    private String cepFile;
    private String octaveFile;
    private Double rms;
    private Double arms;
    private Double srms;
    private Double cf;
    private Double order1Fft1;
    private Double order2Fft1;
    private Double order3Fft1;
    private Double order1Fft2;
    private Double order2Fft2;
    private Double order3Fft2;
    private Double order1EdBpfi;
    private Double order2EdBpfi;
    private Double order3EdBpfi;
    private Double order1EdBpfo;
    private Double order2EdBpfo;
    private Double order3EdBpfo;
    private Double order1EdBsf;
    private Double order2EdBsf;
    private Double order3EdBsf;
    private Double order1EdFtf;
    private Double order2EdFtf;
    private Double order3EdFtf;
    private Double order1EnvG1;
    private Double order2EnvG1;
    private Double order3EnvG1;
    private Double order1EnvG2;
    private Double order2EnvG2;
    private Double order3EnvG2;
    private Double order1EnvG3;
    private Double order2EnvG3;
    private Double order3EnvG3;
    private Double cep1F1;
    private Double cep1F2;
    private Double cep1F3;
    private Double cep2F1;
    private Double cep2F2;
    private Double cep2F3;
    private Double dbPsd1;
    private Double dbPsd2;
    private Double tempVal1;
    private Double tempVal2;
    private Double tempVal3;
    private Double bk1;
    private Double bk2;
    private Double bk3;
    private Double bk4;
    private Double bk5;
    private Double bk6;
    private String bk7;
    private String bk8;
    private Double avg;
    private Double avgR;
    private Double sigma;
    private Double sd;
    private Double pp;
    private Double order1Fft3;
    private Double order2Fft3;
    private Double order3Fft3;
    private Double order1Fft4;
    private Double order2Fft4;
    private Double order3Fft4;
    private Double order1Fft5;
    private Double order2Fft5;
    private Double order3Fft5;
    private Double order1Fft6;
    private Double order2Fft6;
    private Double order3Fft6;
    private Double order1EdBpfI2;
    private Double order2EdBpfI2;
    private Double order3EdBpfI2;
    private Double order1EdBpfO2;
    private Double order2EdBpfO2;
    private Double order3EdBpfO2;
    private Double order1EdBsf2;
    private Double order2EdBsf2;
    private Double order3EdBsf2;
    private Double order1EdFtf2;
    private Double order2EdFtf2;
    private Double order3EdFtf2;
    private Double order1EdBpfI3;
    private Double order2EdBpfI3;
    private Double order3EdBpfI3;
    private Double order1EdBpfO3;
    private Double order2EdBpfO3;
    private Double order3EdBpfO3;
    private Double order1EdBsf3;
    private Double order2EdBsf3;
    private Double order3EdBsf3;
    private Double order1EdFtf3;
    private Double order2EdFtf3;
    private Double order3EdFtf3;
    private Double order1EdBpfI4;
    private Double order2EdBpfI4;
    private Double order3EdBpfI4;
    private Double order1EdBpfO4;
    private Double order2EdBpfO4;
    private Double order3EdBpfO4;
    private Double order1EdBsf4;
    private Double order2EdBsf4;
    private Double order3EdBsf4;
    private Double order1EdFtf4;
    private Double order2EdFtf4;
    private Double order3EdFtf4;
    private Double order1EdBpfI5;
    private Double order2EdBpfI5;
    private Double order3EdBpfI5;
    private Double order1EdBpfO5;
    private Double order2EdBpfO5;
    private Double order3EdBpfO5;
    private Double order1EdBsf5;
    private Double order2EdBsf5;
    private Double order3EdBsf5;
    private Double order1EdFtf5;
    private Double order2EdFtf5;
    private Double order3EdFtf5;
    private Double order1EdBpfI6;
    private Double order2EdBpfI6;
    private Double order3EdBpfI6;
    private Double order1EdBpfO6;
    private Double order2EdBpfO6;
    private Double order3EdBpfO6;
    private Double order1EdBsf6;
    private Double order2EdBsf6;
    private Double order3EdBsf6;
    private Double order1EdFtf6;
    private Double order2EdFtf6;
    private Double order3EdFtf6;
    private Double cep1G1F1;
    private Double cep1G1F2;
    private Double cep1G1F3;
    private Double cep1G2F1;
    private Double cep1G2F2;
    private Double cep1G2F3;
    private Double cep2G1F1;
    private Double cep2G1F2;
    private Double cep2G1F3;
    private Double cep2G2F1;
    private Double cep2G2F2;
    private Double cep2G2F3;
    private Double cep3F1;
    private Double cep3F2;
    private Double cep3F3;
    private Double cep3G1F1;
    private Double cep3G1F2;
    private Double cep3G1F3;
    private Double cep3G2F1;
    private Double cep3G2F2;
    private Double cep3G2F3;
    private Double bk9;
    private Double bk10;
    private Double bk11;
    private Double bk12;
    private Double bk13;
    private Double bk14;

    public boolean verify(){
        return this.eqId != null && this.sensorId != null;
    }

    public SensorDataAbbreviation toAbbreviation() {
        return SensorDataAbbreviation.builder()
                .id(this.getId())
                .uploadStatus(this.getUploadStatus())
                .stationId(this.getStationId())
                .time(this.getTime())
                .eqId(this.getEqId())
                .vibSensorNo(this.getVibSensorNo())
                .timeSigFile(this.getTimeSigFile())
                .fftFile(this.getFftFile())
                .psdFile(this.getPsdFile())
                .envelopeFile(this.getEnvelopeFile())
                .cepFile(this.getCepFile())
                .octaveFile(this.getOctaveFile())
                .rms(this.getRms())
                .arms(this.getArms())
                .build();
    }

    public String toLogString() {
        return this.eqId + " " +
                this.sensorId + " " +
                this.time + " ";
    }
}
